############################################################################## 
## 
## Get-PrivateProfileString.ps1 
## 
## Get an entry from an INI file. 
## 
## ie: 
## 
##  PS >Get-PrivateProfileString.ps1 C:\winnt\system32\ntfrsrep.ini text DEV_CTR_24_009_HELP 
## 
############################################################################## 

param( 
    $file, 
    $category, 
    $key) 

## Prepare the parameter types and parameter values for the Invoke-WindowsApi script 
$returnValue = New-Object System.Text.StringBuilder 500 
$parameterTypes = [string], [string], [string], [System.Text.StringBuilder], [int], [string] 
$parameters = [string] $category, [string] $key, [string] "", 
   [System.Text.StringBuilder] $returnValue, [int] $returnValue.Capacity, [string] $file 

## Set current directory
$currentDir = Get-Location
$scriptDir = (split-path $myinvocation.mycommand.path -parent)
Set-Location $scriptDir

## Invoke the API 
[void] (.\Invoke-WindowsApi.ps1 "kernel32.dll" ([UInt32]) "GetPrivateProfileString" `
   $parameterTypes $parameters) 

## Restore Location
Set-Location $currentDir

## And return the results 
$returnValue.ToString()